import request from '@/utils/request'

// 添加收支记录
export function addFinance(data) {
  return request({
    url: '/finance/add',
    method: 'post',
    params: data
  })
}

// 修改收支记录
export function updateFinance(data) {
  return request({
    url: '/finance/update',
    method: 'post',
    params: data
  })
}

// 删除收支记录
export function deleteFinance(id) {
  return request({
    url: '/finance/delete',
    method: 'post',
    params: {
      id
    }
  })
}

// 获取收支记录详情
export function getFinanceDetail(id) {
  return request({
    url: '/finance/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 分页查询收支记录
export function getFinanceList(params) {
  return request({
    url: '/finance/page',
    method: 'get',
    params
  })
}

// 统计收支情况
export function getFinanceStat(params) {
  return request({
    url: '/finance/stat',
    method: 'get',
    params
  })
}

// 按分类统计收支情况
export function getFinanceStatByCategory(params) {
  return request({
    url: '/finance/statByCategory',
    method: 'get',
    params
  })
} 